package com.hmall.item.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hmall.item.pojo.Item;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

public interface ItemMapper extends BaseMapper<Item> {
    @Update("UPDATE tb_item set status=#{status} where id=#{id} ")
    void updateStatusById(@Param("id") String id, @Param("status") String status);
    @Update("UPDATE tb_item set stock=stock-#{num} where id=#{itemId}")
    void InventoryControl(@Param("itemId") String itemId, @Param("num") int num);
    @Update("UPDATE tb_item set stock=stock+#{num} where id=#{itemId}")
    void InventoryRollback(String itemId, int num);
}
